<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <style>

    </style>
</head>

<body>
    <div id="app"></div>

     <script>
         const NotFound = {template:`<p>Page not found</p>`};
         const Home = {template:`<p>home page</p>`};
         const About = {template:`<p>about page</p>`};

         const routes = {
             '/':Home,
             '/about':About,
         };

         new Vue({
             el:"#app",
             data:{
                 currentRoute:window.location.pathname,
             },
             computed:{
                 ViewComponent(){
                     console.log(this.currentRoute);
                     return routes[this.currentRoute] || NotFound;
                 }
             },
             render(h){
                 return h(this.ViewComponent);
             }
         });
     </script>
</body>

</html>